package book;

/**
 * @ClassDescription:
 * @JdkVersion: 1.8
 * @Author: 李白
 * @Created: 2024/8/18 18:31
 */
public class BookList {
    private Book[] books;//因为书架是放书的地方，所以在这里创建存放书的数组
    private int usedSize;
    public BookList(){//这样，一旦实例化书架，基本的书的信息就会自动赋予书架上
        this.books = new Book[10];
        books[0] = new Book("三国演义","罗贯中",10,"小说",false);
        books[1] = new Book("红楼梦","曹雪芹",15,"小说",false);
        books[2] = new Book("西游记","吴承恩",20,"小说",false);
        this.usedSize = 3;
    }
    public int getSize(){
        return usedSize;
    }
    public Book getBook(int pos){
        return books[pos];
    }
    public Book[] getBooks(){
        return books;//成员变量可以直接调用
    }
    public void setBook(int currentSize,Book book){
        books[currentSize] = book;
    }
    public void setUsedSize(int usedSize){
        this.usedSize = usedSize;
    }

}
